//
//  BXPersonDataPicCell.m
//  BXlive
//
//  Created by sweetloser on 2020/8/26.
//  Copyright © 2020 cat. All rights reserved.
//

#import "BXPersonDataPicCell.h"
#import <SLDeveloperTools/SLDeveloperTools.h>
#import <Masonry/Masonry.h>
#import <YYWebImage/YYWebImage.h>

@interface BXPersonDataPicCell()

@property (nonatomic,strong)UILabel *titleLabel;//标题
@property (nonatomic,strong)UIImageView *nextImageView;//箭头
@property (nonatomic,strong)UIImageView *rightImgV;//右边的图片

@end
@implementation BXPersonDataPicCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createUI];
    }
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    return self;
}

- (void)createUI{
    
    self.titleLabel = [UILabel initWithFrame:CGRectZero size:14 color:sl_textSubColors alignment:NSTextAlignmentLeft lines:1];
    self.titleLabel.font = SLPFFont(16);
    [self.contentView addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(__ScaleWidth(12));
        make.height.mas_equalTo(__ScaleWidth(22));
        make.centerY.mas_equalTo(0);
    }];
    
    self.nextImageView = [[UIImageView alloc]initWithFrame:CGRectZero];
    self.nextImageView.image = [UIImage imageNamed:@"箭头下一步"];
    [self.contentView addSubview:self.nextImageView];
    [self.nextImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(8);
        make.height.mas_equalTo(12);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-__ScaleWidth(12));
    }];
    
    self.rightImgV = [UIImageView new];
    [self.contentView addSubview:self.rightImgV];
    
    [self.rightImgV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.mas_equalTo(__ScaleWidth(32));
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(self.nextImageView.mas_left).offset(-__ScaleWidth(10));
    }];
    self.rightImgV.layer.masksToBounds = YES;
    self.rightImgV.layer.cornerRadius = 5;
}

- (void)setTitle:(NSString *)title subTitle:(NSString *)subTitle;{
    
    self.titleLabel.text = title;
    
    [self.rightImgV yy_setImageWithURL:[NSURL URLWithString:subTitle] placeholder:CImage(@"placeholder_avatar_67")];
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
